<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<script type="text/javascript">	
	function firstButton()
	{
		document.getElementById("currentPage").value=1;
		document.queryForm.submit();
	}
			
	function preButton()
	{
		var currentPage = "${result.currentPage}";
		if (!currentPage)
		{
			currentPage = "1";
		}
		if(currentPage == "1")
		{
			alert("当前已经是第一页！");
			return false;
		}
		document.getElementById("currentPage").value= parseInt(currentPage, 10) - 1;
		document.queryForm.submit();
	}
			
	function nextButton()
	{
		var currentpage = "${result.currentPage}";
		var totalPage = "${result.totalPage}";
		if (!currentpage)
		{
			currentpage = "1";
		}
		if (!totalPage)
		{
			totalPage = "1";
		}
		if(currentpage == totalPage)
		{
			alert("当前已经是最后页！");
			return false;

		}
		document.getElementById("currentPage").value= parseInt(currentpage, 10) + 1;
		document.queryForm.submit();
	}
			
	function endButton()
	{
		var totalPage = "${result.totalPage}";
		if (!totalPage)
		{
			totalPage = "1";
		}
		document.getElementById("currentPage").value=totalPage;
		document.queryForm.submit();
	}
	
	function isInteger(s)
	{
		var INTEGER = /^[0-9]*$/;
		return INTEGER.test(s);
	}
			
	function jump()
	{
		var number = document.getElementById("goPage").value;
		if (!isInteger(number))
		{
			alert("请输入数字！");
			return false;
		}
		if(trim(number) == "")
		{
			alert("请输入要转到的页数！");
			return false;
		}
		document.getElementById("currentPage").value=number;
		document.queryForm.submit();
	}
	
	function trim(obj)
	{
		return obj.replace(/(^\s*)|(\s*$)/g,"");								
	}
</script>

<table>

	<tr>
		<td class="ye1">
			第${result.currentPage}页
		</td>
		<td class="ye2">
			共${result.totalPage}页
		</td>
		<td class="td33">
			<a onclick="javascript:firstButton();">首页</a>
		</td>
		<td class="td33">
			<a onclick="javascript:preButton();">上一页</a>
		</td>
		<td class="td33">
			<a onclick="javascript:nextButton();">下一页</a>
		</td>
		<td class="td33">
			<a onclick="javascript:endButton();">尾页</a>
		</td>
		<td class="td33">
			跳到
		</td>
		<td class="td33">
			<input type="text" name="goPage" id="goPage"
				class="qinggoudan_input05" size="1">
		</td>
		<td class="td33">
			页
		</td>
		<td class="td6_inner">
			<input name="Submit2" onclick="jump();" type="button"
				 value="GO"
				onMouseOver="className='anniu_s_over'"
				onMouseOut="className='anniu_s_out'">
		</td>
	</tr>
</table>
